-
Notifications
You must be signed in to change notification settings - Fork 10
Add logo overlay to QR code center with adjustable size, file-based history persistence, and cross-page state preservation #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: TheJoeFin <[email protected]>
Co-authored-by: TheJoeFin <[email protected]>
…r file access Co-authored-by: TheJoeFin <[email protected]>
|
@copilot looks good, I make sure the logo image chosen for the center of the code does not get stretched and distorted, consider the aspect ratio of the picked image before making the punchout |
Co-authored-by: TheJoeFin <[email protected]>
Updated both PNG and SVG implementations to preserve logo aspect ratio. The logo now scales to fit within the 20% maximum size constraint while maintaining its original proportions:
The background rectangle also adjusts to match the actual logo dimensions. Fixed in commit 305bd87. |
|
@copilot looking good. Two things to change
|
…SVG encoding Co-authored-by: TheJoeFin <[email protected]>
Implemented both requested features in commit 763412d: 1. Logo size slider with error correction-based limits:
2. SVG optimization:
The slider appears below the logo buttons and only shows when a logo is selected. |
Enhanced logo overlay precision by aligning dimensions and padding to QR code module boundaries. Updated SVG logo embedding for consistency and accuracy. Increased allowable logo size for error correction levels. Added null checks for clipboard operations to improve robustness. Refactored code for better readability and maintainability.
Introduced `logoPaddingPixels` parameter to control padding or cropping around logos in QR codes. Updated `BarcodeHelpers`, `BarcodeImageItem`, and `MainViewModel` to support this feature. Enhanced SVG and bitmap generation logic, added a UI slider for dynamic padding adjustment, and improved code consistency and rendering quality.
Refactored QR code logo embedding logic to use "punchout size" for better clarity and flexibility. Simplified calculations for punchout area, logo dimensions, and padding. Updated SVG embedding to reduce file size and align with new logic. Revised `MainPage.xaml` labels and tooltips to reflect updated terminology and functionality.
Updated `OverlayLogoOnQrCode` and `EmbedLogoInSvg` methods to accept a `backgroundColor` parameter, enabling customization of the punchout background color in both bitmap and SVG formats. Adjusted related logic and comments to reflect this enhancement.
- Adjusted QR code margin for tighter generation. - Enhanced logo overlay logic with improved scaling and alignment. - Refined padding and logo size calculations for better accuracy. - Updated default logo settings for size and padding. - Simplified error correction level handling with fixed values. - Improved stream handling with explicit type usage. - Enhanced UI with `SplitButton` for logo options and sliders. - Consolidated bindings and improved code readability in XAML. - Standardized formatting and improved code consistency. - Fixed logo resizing issues and minor binding inconsistencies.
|
@copilot make sure that history saves and restores the data around images as well such as size, scale, and store the logo in local app storage and a path to that item on the history item. |
Co-authored-by: TheJoeFin <[email protected]>
Implemented history support for logo images in commit 9a2e144: Logo Storage:
HistoryItem Properties Added:
Restoration:
Implementation:
|
|
@copilot also store and retrieve the logo image zoom/padding pixels number with the history item |
Co-authored-by: TheJoeFin <[email protected]>
Added logo padding pixels to history persistence in commit 9c23fe9: HistoryItem Property Added:
Implementation:
The padding/zoom setting is now fully preserved across app sessions and history navigation. |
|
@copilot now there is an error where with the new image field the settings cannot hold the history JSON in one setting, so break out the settings JSON to save it in the local storage. Also ensure there is a migration check if there is history it needs to be saved to a file and cleared out, if not then just use the standard storage |
…pport Co-authored-by: TheJoeFin <[email protected]>
Moved history storage from settings to separate file in commit 93694fe: New Storage Location:
Migration Logic:
Implementation:
The change resolves the JSON size limit issue while preserving all existing history data through automatic migration. |
|
@copilot when moving between pages use a HistoryItem in the parameters that way the full state can be restored such as colors and logos if there are any |
…olors and logos Co-authored-by: TheJoeFin <[email protected]>
Updated navigation to pass HistoryItem for full state restoration in commit 8d460d6: MainViewModel Changes:
SettingsViewModel Changes:
DecodingViewModel Changes:
State Preserved:
|
Refine the logic for setting the SizeTextVisible property to also hide the size text when a logo image is present, in addition to the existing HideMinimumSizeText condition.
Reduced the `Spacing` property of the `StackPanel` named `QrCodeOptions` from `12` to `6` to optimize spacing. Decreased the `Width` of the "Code Color" and "Background Color" buttons from `68` to `48` to improve the visual design and save space in the user interface.
Summary of changes:
LocalFolder/LogoImages)LocalFolder/History.json) instead of settingsAspect Ratio Preservation:
Logo Size Control:
SVG Optimization:
History Persistence:
LogoImagePath,LogoSizePercentage, andLogoPaddingPixelsstored in HistoryItem modelSaveCurrentStateToHistory()made async to properly save logo filesHistory.jsonfile instead of settings to avoid size limitationsFile-Based History Storage:
LocalFolder/History.jsoninstead of application settingsSystem.Text.Json.JsonSerializerwith indented formatting for readabilityCross-Page Navigation State Preservation:
MainViewModel creates
HistoryItemfrom current state when navigating to other pagesSettingsViewModel stores and returns
HistoryItemwhen returning to main pageDecodingViewModel stores and returns
HistoryItemwhen returning to main pageOnNavigatedTomethods accept bothHistoryItem(full state) andstring(backward compatible)RestoreFromHistoryItemmethod in MainViewModel applies complete state restorationState preserved includes: text content, foreground/background colors, error correction level, logo image, logo size percentage, logo padding pixels
currentLogoPathfield tracks logo file path for seamless navigationWorks across all navigation flows: Main ↔ Settings, Main ↔ Decoding, Decoding → Edit QR Code
Fixes Punchout to add a logo or image to center of QR Code #14
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.